﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SimpleListEditor
{
    public partial class ControlTester : Form
    {
        public class TestStruct
        {
            public TestStruct(string name)
            {
                this.name = name;
            }
            private string name;

            public string Name
            {
                get { return name; }
                set { name = value; }
            }
            private string description;

            public string Description
            {
                get { return description; }
                set { description = value; }
            }
            public override string ToString()
            {
                return Name;
            }
        }
        Dictionary<string, TestStruct> dData = new Dictionary<string, TestStruct>();
        ListEditorControl<TestStruct> theControl = null;

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ControlTester frm = new ControlTester();
            Application.Run(frm);

        }

        public ControlTester()
        {
            InitializeComponent(); 
            theControl = new ListEditorControl<TestStruct>(ref dData);
            theControl.Dock = DockStyle.Fill;
            dData.Add("TestPlayer1", new TestStruct("TestPlayer1"));
            dData.Add("Testkeyforplayer2", new TestStruct("TestPlayer2"));
            this.Controls.Add(theControl);
            theControl.ListItems = dData;
            theControl.RefreshItems();
        }
    }
}
